#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main() {
    double price;
    int month, day, flag;
    scanf("%lf%d%d%d", &price, &month, &day, &flag);
    if (month == 11 && day == 11)
    {
        price = price * 0.7 - 50 * flag;
    }
    else if (month == 12 && day == 12)
    {
        price = price * 0.8 - 50 * flag;
    }
    if (price < 0)
    {
        printf("0.00");
    }
    else
    {
        printf("%.2lf", price);
    }

    return 0;
}